package com.mobile.learning;

import com.mobile.learning.lib.DBClass;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.view.MotionEvent;
import android.view.Window;
import android.view.WindowManager;

public class SplashActivity extends Activity {

	protected int _splashTime = 3000;
	private Thread splashTread;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_splash);

		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);

		final SplashActivity sPlashScreen = this;
	
		splashTread = new Thread() {
			public void run() {
				try {
					synchronized (this) {
						wait(_splashTime);
					}
				} catch (Exception e) {
					// TODO: handle exception
				} finally {

					finish();
					Intent i = new Intent();
					i.setClass(sPlashScreen, MainMenuActivity.class);
					startActivity(i);
				}

			}
		};
		splashTread.start();
	}

	@Override
	public boolean onTouchEvent(MotionEvent event) {
		if (event.getAction() == MotionEvent.ACTION_DOWN) {
			synchronized (splashTread) {
				splashTread.notifyAll();
			}
		}
		return true;
	}

}
